Elasticsearch provides developers with a set of restful interfaces based on the HTTP protocol, and only needs to construct a rest request and parse the JSON returned by the request for access to the Elasticsearch server. Elasticsearch API interface is rich in functionality,
By adding search data through the rest API, reading the official documentation reveals that Elasticsearch supports dynamic mapping, but there are a lot of questions and listen slowly.
This article mainly tells about three points content:
1 Elasticsearch Common REST
).curl localhost:9200/_bulk?pretty --data-binary @data.jsonSimilarly, if you follow the above definition of _index but do not define _type, then the index is test123 and the type is the type specified in our Curl command.Execute the above command curl http://localhost:9200/test123/test123/_bulk?pretty --data-binary @data.jsonGet the following results{ "took" : 1233, "errors" : false, "items" : [ { "index" : { "_index" : "test123", "_type" : "test123", "_id" : "1", "_ver
The main content of this article:1 common operations for ElasticSearch2 ElasticSearchBulk Command
ES REST APIThe Elasticsearch supports a variety of communications, including the HTTP request response service, so you can send HTTP requests with the Curl command and get the JSON return content.Common REST requests are:Check cluster statusCurl Localhost:9200/
Chapter ContentConnect to a local or remote Elasticsearch cluster using the client object.Index documents individually or in batches.Updates the contents of the document.Use a variety of Elasticsearch supported query methods.Handles the error message returned by the Elasticsearch.Collect cluster state information or perform administrative tasks by sending various management directives.
8.3 Connect to c
5.1.1 's search highlighting and 2. X has changed, but not much. Here are four steps to: Create an index (set Mapping/ik participle), index document, search highlighting for REST API, search highlighting for JAVA API.Note: Starting with this blog, use the shorthand code style, which is the style used in the sence plugin or Kibana dev tools. (Tip: To install Kiban
ElasticSearch JAVA API Official document: Https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-docs-index.htmlFirst, generate JSONThe first step in creating an ind
blog with a type of Article,id 1:DeleteResponse dResponse = client.prepareDelete("blog""article""1").execute().actionGet();by Deleteresponse the Isfound () method of the object, you can get the success of the deletion, and the return value is a Boolean type.Third, delete through queryelasticsearch-2.3 and older APIs are not the same, install plugins:delete-by-queryDelete the index named Twitter, with all documents of type Tweet,user field containing kimchy:DELETE /twitter/tweet/_query?q=user:ki
document that deletes an index named blog with a type of Article,id 1:DeleteResponse dResponse = client.prepareDelete("blog", "article", "1").execute().actionGet();
1
2
by Deleteresponse the Isfound () method of the object, you can get the success of the deletion, and the return value is a Boolean type.Third, delete through queryelasticsearch-2.3 and older APIs are not the same, install plugins:delete-by-query
1
When a cluster has multiple nodes, each node needs
This Learning note comes from the ES official website's Guidance document: ES JAVA API Client client is a class that enables various operations on the ES cluster: Index, GET, Delete, Search , as well as management tasks for ES clusters. Client constructs need to be based on the transportclient transportclient transportclient can remotely connect ES clusters through a transmission module, but it is not r
]View PlainCopy
Searchhits hits = Myresponse.gethits ();
for (int i = 0; i
System.out.println (Hits.gethits () [I].getsourceasstring ());}
It can also use Hits.gethits () [I].getsource (), which is a map format that can be displayed in detailThird, the implementation of other APIs during the searchWhen we read the DSL, we can see that the query has a lot of queries, such as multi-domain, such as filtering query conditions, the following for the
].getsourceasstring ());}
It can also use Hits.gethits () [I].getsource (), which is a map format that can be displayed in detailThird, the implementation of other APIs during the searchWhen we read the DSL, we can see that the query has a lot of queries, such as multi-domain, such as filtering query conditions, the following for the Elasticsearch server development of some basic query DSL given in the Java
This blog describes an easy way to index multiple documents Elasticsearch. The support of the Bulk API enables you to perform batch additions, deletions, updates, and so on at one time. The bulk operation uses the UDP protocol, and UDP cannot ensure that data is not lost when communicating with the Elasticsearch server. First, Bulk
processing index. If you need to put a string as a whole to be indexed, this field needs to be set: Field ("Index", "not_analyzed").Index data /** * Bulk Index */@Test public void Indexdata () {Bulkrequestbuilder Requestbuilder = Client.preparebu LK (); for (person person:personlist) {String obj = getindexdatafromhotspotdata (person); if (obj! = null) {Requestbuilder.add (Client.prepareindex ("Test_index", "Test", String.valueof (Person.getid ())) . Setrefresh (T
ElasticSearch java API-use More like this to implement Content-based recommendation
ElasticSearch java API-use More like this to implement Content-based recommendation
Content-based recommendations generally give a document inform
/releasesTo download the version of the ES that you are using
IK version ES version
master 2.1.1-> master
1.7.0 2.1.1
1.6.1 2.1.0 1.5.0 2.0.0
1.4.1 1.7.2
1.4.0 1.6.0
1.3.0 1.5.0 1.2.9 1.4.0 1.2.8 1.3.2
1.2.7 1.2.1
1.2.6 1.0.0
1.2.5 0.90.x
1.1.3 0.20.x
1.1.2 0.19.x
1.0.0 0.16.2-> 0.19.0As shown above, individuals believe that a version of the high will be compatible with the low version
After the download is complete, unpack and then package using MVN package, where you need to install MAVEN,
1, full-text query overview
Https://www.elastic.co/guide/en/elasticsearch/client/java-api/6.1/java-full-text-queries.html
The high-level full text queries are usually used to running full text queries on full text fields like the ' body of ' an EM Ail. They understand how the field being queried are analyzed and would
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.